import { ApiProperty } from '@nestjs/swagger';
import { IsString, Length, IsNotEmpty } from 'class-validator';

export class LoginDto {
  @ApiProperty({
    description: '用户名',
    example: 'admin'
  })
  @IsString()
  @Length(4, 20, { 
    message: '用户名长度必须在4到20个字符之间' 
  })
  username: string;

  @ApiProperty({
    description: '密码',
    example: '123456'
  })
  @IsString()
  @Length(6, 20,  { 
    message: '密码长度必须在6到20个字符之间' 
  })
  password: string;

  @ApiProperty({
    description: '验证码',
    example: '1234'
  })
  @IsString({ message: '验证码必须是字符串类型' })
  @IsNotEmpty({ message: '验证码不能为空' })
  captchaCode: string;

  @ApiProperty({
    description: '验证码key',
    example: 'abcd-efgh-ijkl'
  })
  @IsString({ message: '验证码key必须是字符串类型' })
  @IsNotEmpty({ message: '验证码key不能为空' })
  captchaKey: string;
}